Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Encode and decode Hashes from and to base58 #138

Merged
merged 4 commits into from
Aug 30, 2019
Merged

Conversation

NicolasMahe
Copy link
Member

Fix https://github.com/mesg-foundation/cli/issues/137

Related to https://github.com/mesg-foundation/mesg-js/issues/123 and mesg-foundation/engine#1265.

Because of mesg-foundation/engine#1270, hashes are now in bytes instead of string over the gRPC API.

This PR update the CLI to use mesg-js version of mesg-foundation/mesg-js#124 and encode / decode the hash properly.

@NicolasMahe NicolasMahe added this to the next milestone Aug 29, 2019
@NicolasMahe NicolasMahe self-assigned this Aug 29, 2019
@NicolasMahe NicolasMahe changed the title Feature/hash as bytes Encode and decode Hashes from and to base58 Aug 29, 2019
@@ -56,7 +58,12 @@ export default abstract class extends Command {
styledJSON(data: any) {
const {flags} = this.parse()
if (flags.silent) return
cli.styledJSON(data)
const base58EncodedHash = JSON.parse(JSON.stringify(data, (key: string, value: any): any => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If somebody has a better way instead of JSON.parse(JSON.stringify, please implement it :)

src/root-command.ts Outdated Show resolved Hide resolved
@antho1404
Copy link
Member

I'm not sure it is some part forgotten so just checking

Is that normal? Anyway I will work more on it for the new compilation so I will be able to test/fix that

@antho1404 antho1404 merged commit c9e00bc into master Aug 30, 2019
@antho1404 antho1404 deleted the feature/hash-as-bytes branch August 30, 2019 09:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encode and decode Hashes from and to base58
2 participants